using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using System;



public enum PitType{stab}

public class PitfallFSM:MonoBehaviour{


    public PitType pitType;

    public Dictionary<PitType, Pitfall> pitfall = new Dictionary<PitType, Pitfall>();


    private Animator animator;
    private AnimatorStateInfo animatorInfo;
    private float animatorInfoTime;

    private bool isTrue;


    private void start(){
       
        animator = transform.GetComponent<Animator>();
          pitfall[pitType].AnimAction(); 

    }

    private void update(){

            if(isTrue){
                 animatorInfo = animator.GetCurrentAnimatorStateInfo(0);
                  animatorInfoTime = animatorInfo.normalizedTime;

            }
    }

    private void awake(){

        pitfall.Add(PitType.stab,new Stab());


    }



  // TODO： 触发器
    //根据tag
    private void OnTriggerEnter2D(Collider2D collision){
            isTrue=true;

            if (animatorInfo.normalizedTime >= 0.95f && animatorInfo.IsName("陷阱"))
            {
                pitfall[pitType].Effect(collision.gameObject);
            }
        //开始获取动画的状态，

      
      


    }









}